
import { GlobalVar } from "../../common/globalvar";
class DynamicSvc {
    constructor(dataManger) {
        this.dataManger = dataManger;
    }

    switchState(gid, state) {
        let graph = this.getGraph(gid);
        if (!graph) {
            return -1;
        }
        let ret = 0;
        let symbol = graph.getSymbol();
        if (symbol){
            let typeid = symbol.m_typeID;
            let dstSymbol = this.dataManger.getSymbolManager().getSymbol(typeid,state);
            if (dstSymbol){
                graph.setSymbol(dstSymbol);
                ret = 1;
            }
            else{
                ret = -1;
            }
        }
        return ret;
    }

    locateTo(gid){
        
    }

    setScale(scale){
        let mapInfo = this.dataManger.getMapViewInfo();
        mapInfo.setScaling(scale);
    }

    getGraph(gid) {
        let graph = null
        if (gid == 0) {
            graph = this.dataManger.getCurentGraph();
        }
        else {
            graph = this.dataManger.findGraph(gid);
        }
        return graph;
    }

    

}

export default { DynamicSvc }